<?php

/**
 * Accounts form base class.
 *
 * @method Accounts getObject() Returns the current form's model object
 *
 * @package    maxgifts
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseAccountsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'user_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Users'), 'add_empty' => false)),
      'login'         => new sfWidgetFormTextarea(),
      'password'      => new sfWidgetFormTextarea(),
      'email'         => new sfWidgetFormTextarea(),
      'maxgift_coins' => new sfWidgetFormInputText(),
      'tokens'        => new sfWidgetFormInputText(),
      'created_at'    => new sfWidgetFormDateTime(),
      'modified_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'user_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Users'))),
      'login'         => new sfValidatorString(),
      'password'      => new sfValidatorString(),
      'email'         => new sfValidatorString(),
      'maxgift_coins' => new sfValidatorInteger(array('required' => false)),
      'tokens'        => new sfValidatorInteger(array('required' => false)),
      'created_at'    => new sfValidatorDateTime(),
      'modified_at'   => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('accounts[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Accounts';
  }

}
